#include "toolbarview.h"
#include "ui_toolbarview.h"

ToolBarView::ToolBarView(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ToolBarView)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);//隐藏标题设置为顶层显示
    BG = new QButtonGroup();
    //把控件添加QButtonGroup，控件ID，序号
    BG->addButton(ui->Btn_sampleanalyse,1);
    BG->addButton(ui->Btn_listreview,2);
    BG->addButton(ui->Btn_qualitycontrol,3);
    BG->addButton(ui->Btn_reagentmanage,4);
    BG->addButton(ui->Btn_adddilution,5);
    BG->addButton(ui->Btn_print,6);
    connect(BG,SIGNAL(buttonClicked(int)),this,SLOT(getmenuwinBG(int)));
}

ToolBarView::~ToolBarView()
{
    delete ui;
}

void ToolBarView::getmenuwinBG(int a)
{
    switch(a)
    {
    case 1:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_SampleAnalysisView);
        break;
    case 2:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_CountReview);
        break;
    case 3:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_LJQuailtyControl);
        break;
    case 4:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_Reagent);
        break;
    case 5:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_AddDiluentDialog);
        break;
    case 6:
        MainController::getInstance()->setCurrentWidgetID(MainController::E_PrintView);
        break;
    }
}

void ToolBarView::setBottonHide(int index, bool hide)
{
    switch(index)
    {
    case 1:
        ui->Btn_sampleanalyse->setEnabled(hide);
        break;
    case 2:
        ui->Btn_listreview->setEnabled(hide);
        break;
    case 3:
        ui->Btn_qualitycontrol->setEnabled(hide);
        break;
    case 4:
        ui->Btn_reagentmanage->setEnabled(hide);
        break;
    case 5:
        ui->Btn_adddilution->setEnabled(hide);
        break;
    case 6:
        ui->Btn_print->setEnabled(hide);
        break;
    }
}
